package pl.nith.battleships.controllers.factories;

import pl.nith.battleships.helpers.ShipHelper;
import pl.nith.battleships.models.ship.AircraftCarrier;
import pl.nith.battleships.models.ship.Battleship;
import pl.nith.battleships.models.ship.Destroyer;
import pl.nith.battleships.models.ship.PatrolBoat;
import pl.nith.battleships.models.ship.Ship;
import pl.nith.battleships.models.ship.Submarine;

public class ShipFactory
{
	public static Ship createShip(ShipHelper.Type shipType)
	{
		switch(shipType)
		{
			case AIRCRAFT_CARRIER:
			{
				return new AircraftCarrier();
			}
			
			case BATTLESHIP:
			{
				return new Battleship();
			}
			
			case DESTROYER:
			{
				return new Destroyer();
			}
			
			case SUBMARINE:
			{
				return new Submarine();
			}
			
			case PATROL_BOAT:
			{
				return new PatrolBoat();
			}
		}
		
		throw new IllegalArgumentException("Ship type " + shipType + "does not exist!");
	}
}
